<template>
  <el-dialog :title="'输入验证码（5分钟内有效）'" :visible.sync="visible">
    <div>
      <el-input type="number" v-model="smscode" placeholder="请输入验证码"></el-input>
    </div>
    <div
        slot="footer"
        class="dialog-footer"
    >
      <el-button
          type="primary"
          @click="confirmSigning"
      >确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { sendSigning,confirmSigning } from '@/api/order'
export default {
  data() {
    return {
      visible: false,
      smscode:'',
      order_id:null
    }
  },
  methods: {
    done:()=>{},
    open(order_id,done) {
      this.smscode = "";
      this.order_id = order_id;
      sendSigning({
        order_id
      }).then((res)=>{
        this.visible = true
        this.done = done;
      })

    },
    confirmSigning(){
      confirmSigning({
        order_id:this.order_id,
        code:this.smscode
      }).then((res)=>{
        this.$message.success("签署成功");
        this.visible = false;
        this.done && this.done();
      })
    },
    close() {
      this.visible = false
    }
  }
}
</script>
<style  lang="scss" scoped>

</style>
